


<template>
  <div class="EmergencyDetail">
    <div class="flex location-wrap">
        <span class="white">当前位置：</span>
      <el-breadcrumb separator="/">
        <el-breadcrumb-item :to="{ path: '/EDManagement' }">应急处置</el-breadcrumb-item>
        <el-breadcrumb-item :to="{ path: '/EmergencyList' }">应急事件</el-breadcrumb-item>
        <el-breadcrumb-item>详情</el-breadcrumb-item>
      </el-breadcrumb>
    </div>
    <div class="EmergencyDetail-center">
      <TimeLine :activities="activities" :title="'应急事件流程'" />
      <div class="EmergencyDetail-add">
        <div class="EmergencyDetail-titel">
          <div class="EmergencyDetail-top">应急事件详情</div>
          <div class="flexBetween">
            <div slot="title" class="flex">
              <!-- <div class="leftLine"></div> -->
              <div class="fontSize16"></div>
            </div>
            <el-row>
              <el-button size="mini" @click="AddFh">返回</el-button>
            </el-row>
          </div>
        </div>
        <div class="EmergencyDetail-zt">
          <el-collapse v-model="activeNames">
            <el-collapse-item name="1">
              <div slot="title" class="title_box">
                <div class="flex">
                  <div class="leftLine"></div>
                  <div class="fontSize16">信息来源</div>
                </div>
                <div style="display:flex;align-items: center;">
                  <i :class="judgeActive('1')!==-1? 'downArrow1':'downArrow2'" />
                </div>
              </div>
              <div class="information_Sources_content">
                <!-- <div class="task_distribution">
                  <div>信息来源：{{DetailList.infoSource}}</div>
                </div> -->
                <div class="task_distribution information">
                  <div>信息来源：{{DetailList.infoSource}}</div>
                  <div v-if="isShow">预警通知单：{{warningNoticeName}}</div>
                </div>
              </div>
            </el-collapse-item>
            <el-collapse-item name="2">
              <div slot="title" class="title_box">
                <div class="flex">
                  <div class="leftLine"></div>
                  <div class="fontSize16">基本信息</div>
                </div>
                <div style="display:flex;align-items: center;">
                  <i :class="judgeActive('2')!==-1? 'downArrow1':'downArrow2'" />
                </div>
              </div>
              <div class="information_Sources_content">
                <div class="information_Sources_content">
                  <div class="task_distribution marginB15">
                    <div>应急事件：{{DetailList.emergencyEvent}}</div>
                  </div>
                </div>
                <div class="information_Sources_content">
                  <div class="task_distribution information">
                    <div>事件类别：{{DetailList.eventName}}</div>
                    <div>事件级别：{{DetailList.eventLvName}}</div>
                    <div>影响范围：{{DetailList.effectRange}}</div>
                    <div>发生时间：{{DetailList.occurrenceTime}}</div>
                  </div>
                </div>
                <div class="information_Sources_content">
                  <div class="task_distribution  nametites">
                    <div class="nametite">事件概要：</div>
                    <div class="nametit">{{DetailList.incidentOutline}}</div>
                  </div>
                </div>
                <div class="information_Sources_content">
                  <div class="task_distribution marginB15">
                    <div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;附件：<router-link to="" class="" v-for="(item ,index) in attachInfo" :key="index"><span @click="handlePreview(item)">{{item.attachName}}</span></router-link>
                    </div>
                  </div>
                </div>
              </div>
            </el-collapse-item>
            <el-collapse-item name="3">
              <div slot="title" class="title_box">
                <div class="flex">
                  <div class="leftLine"></div>
                  <div class="fontSize16">填报信息</div>
                </div>
                <div style="display:flex;align-items: center;">
                  <i :class="judgeActive('3')!==-1? 'downArrow1':'downArrow2'" />
                </div>
              </div>
              <div class="information_Sources_content">
                <div class="task_distributions informations">
                  <div>填报人：{{DetailList.creator}}</div>
                  <div>单位及部门：{{DetailList.createDeptName}}</div>
                  <div>填报时间：{{DetailList.createTime}}</div>
                </div>
              </div>
            </el-collapse-item>
          </el-collapse>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { EmergencyEventgetById, getFlowList } from "@/api/EmergencyDisposal/yjsj.js";
import { loadFile } from "@/api/common.js";
import { detailList } from "@/api/EarlyWarningManagement/yjtzd";
import TimeLine from "@/components/component/timeLine.vue";
export default {
  name: "EmergencyDetail",
  components: { TimeLine },
  data() {
    return {
      activeNames: ["1", "2", "3"],
      activities: [],
      DetailList: {},
      attachInfo: [],
      warningNoticeName: "",
      isShow: false
    };
  },
  mounted() {
    this.detailList();
    this.getFlowList();
  },
  methods: {
    judgeActive(data) {
      return this.activeNames.indexOf(data);
    },
    async detailList() {
      const res = await EmergencyEventgetById(
        { id: this.$route.query.id });
      this.DetailList = res;
      this.attachInfo = res.attachInfo;
      this.detailListNoticeId(res.noticeId || "");

    },
    async detailListNoticeId(val) {
      const res = await detailList({ id: val });
      this.warningNoticeName = res.warningNoticeName;
      if (res.warningNoticeName !== "") {
        this.isShow = true;
      }
    },
    // 下载
    handlePreview(item) {
      // this.$message({
      //   message: "功能开发中",
      //   type: "success"
      // });
      console.log(item, "item");
      const loading = this.$loading({
        lock: true,
        text: "Loading",
        spinner: "el-icon-loading",
        background: "rgba(0, 0, 0, 0.6)"
      });
      loadFile({ id: item.attachId }).then(res => {
        const a = document.createElement("a");
        const objectUrl = URL.createObjectURL(res);
        a.setAttribute("href", objectUrl);
        a.setAttribute("download", item.attachName);
        a.click();
        loading.close();
      }).catch(() => {
        loading.close();
      });
    },
    async getFlowList() {
      const res = await getFlowList({ emergencyId: this.$route.query.id });
      this.activities = res;
    },
    // 返回上一级
    AddFh() {
      // this.$router.push({
      //   name: "EmergencyList"
      // });
      this.$router.go(-1);
    }
  }
};
</script>

<style scoped lang="less">
.EmergencyDetail {
  width: 100%;
  height: 100%;
  :deep(.el-timeline) {
    width: 85%;
    margin-left: 35px;
    margin-top: 30px;
  }
  :deep(.el-collapse-item__arrow) {
    display: none;
  }
  .nametite {
    width: 80px;
  }
  .nametit {
    flex: 1;
  }
  .nametites {
    display: flex;
  }
  .title_box {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .downArrow1 {
    display: inline-block;
    width: 10px;
    height: 10px;
    background-image: url("../../../../assets/img/downArrow1.png");
    background-repeat: no-repeat;
    background-size: 100% 100%;
  }
  .downArrow2 {
    display: inline-block;
    width: 10px;
    height: 10px;
    background: url("../../../../assets/img/downArrow1.png");
    background-repeat: no-repeat;
    background-size: 100% 100%;
    transform: rotate(-180deg);
  }
  :deep(.el-breadcrumb__inner.is-link) {
    font-weight: 100;
    color: #fff;
  }
  :deep(.el-breadcrumb__item:last-child .el-breadcrumb__inner) {
    color: #3270ff;
  }
  :deep(.el-breadcrumb) {
    font-size: 16px;
    line-height: initial;
  }
  .EmergencyDetail-center {
    width: 100%;
    height: 100%;
    margin-top: 10px;
    display: flex;
    justify-content: space-between;
    .EmergencyDetail-add {
      width: 83%;
      height: 100%;
      background-color: #fff;
      border-radius: 5px;
      overflow: auto;
      .EmergencyDetail-titel {
        margin: 0 20px;
        position: relative;
        padding: 10px 0 5px 0;
        // border-bottom: solid 1px #ccc;
        .EmergencyDetail-top {
          text-align: center;
          font-family: 微软雅黑;
          font-weight: 400;
          font-style: normal;
          font-size: 28px !important;
        }
      }
      .EmergencyDetail-zt {
        overflow-y: auto;
        margin: 0 20px;
        :deep(.el-button--text) {
          color: #606266;
          padding: 2px;
        }
        .EmergencyList-dialog-form-item {
          display: flex;
          justify-content: space-between;
          flex-wrap: wrap;
        }
        .task_distribution {
          display: flex;
          // align-items: center;
          padding: 0 30px;
          font-size: 16px;
          span {
            color: #3561fd;
            text-decoration: underline;
          }
        }
        .task_distributions {
          display: flex;
          align-items: center;
          padding: 0 30px;
          font-size: 16px;
          span {
            color: #3561fd;
            text-decoration: underline;
          }
        }
        .task_distribution.information {
          flex-wrap: wrap;
          div {
            width: 50%;
            margin-bottom: 12px;
            align-items: center;
            img {
              position: relative;
              top: 5px;
              left: 10px;
            }
          }
        }
        .task_distributions.informations {
          flex-wrap: wrap;
          div {
            width: 33%;
            margin-bottom: 12px;
            align-items: center;
            img {
              position: relative;
              top: 5px;
              left: 10px;
            }
          }
        }
      }
    }
  }
}
:deep(.el-step__icon.is-text) {
  border: none;
}
:deep(.el-collapse-item__content) {
  padding-top: 5px;
  padding-bottom: 10px;
  font-size: 16px;
}
.yuandian1 {
  display: inline-block;
  background-color: #ccc;
  width: 100%;
  height: 100%;
  border-radius: 50%;
}
.ydBgcolor {
  background-color: #246dfd;
  box-shadow: 0px 0px 8px 0px rgb(10, 99, 241);
}
.EmergencyList-table-pag {
  float: right;
  margin-top: 10px;
  > div {
    line-height: 32px;
  }
}
:deep(.el-table) {
  font-size: 16px;
  tr {
    > :last-child {
      padding: 0;
      img {
        display: block;
        margin: auto;
      }
    }
  }
  .white-row {
    background: #f0f2f5;
  }
}
:deep(.el-collapse-item__header) {
  border-bottom: 1px solid #ccc;
}
:deep(.el-collapse-item__content) {
  padding: 15px 0;
}
:deep(.el-collapse-item__wrap) {
  border: none;
}
.grid-content {
  background-color: #b1c8f9;
  border: 1px solid #d7d7d7;
  text-align: center;
  padding: 8px 0;
}
.grid-content.bottom_col {
  background-color: #f0f2f5;
  border: 1px solid #d7d7d7;
}
.grid-content.top_col {
  background-color: #fff;
  border-top: none;
  border-bottom: none;
}
</style>



